package com.atwisdom.star.dcs.Thread;

import com.atwisdom.star.dcs.util.Utils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class DataCollectionThread implements Runnable  {

    /*@Autowired
    private DataCollectionServiceImpl dataCollectionService;*/

    @Value("${das.isRunning}")
    private boolean isRunning;

    @Override
    public void run() {
        while (isRunning) {
//            if(!this.dataCollectionService.isRunning()){
//                System.out.println("采集配置初始化开始");
//                this.dataCollectionService.init();
//                System.out.println("采集配置初始化完成");
//            }
            try {
                System.out.println("采集配置初始化开始");
//                this.dataCollectionService.init();
                System.out.println("采集配置初始化完成");

                System.out.println("采集数据开始");
//                this.dataCollectionService.dealRealTimeData();
                System.out.println("本次采集数据结束");
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            //每5秒获取一次
            Utils.sleep(5000l);
        }
    }
}
